package com.lelaohui.net.request;

import android.text.TextUtils;
import android.util.Log;

import com.lelaohui.net.utils.UrlsTools;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by T460p on 2017/3/15.
 */

public class LRequest implements IRequest {
    private Map<String ,Object> data=null;
    private boolean isShowProgress=true;
    private String uri=null;
    private String uriType="";
    private String reqType="";
    public Type getType() {
        return type;
    }

    @Override
    public String getUri() {
        return this.uri;
    }

    @Override
    public String getUriType() {
        return this.uriType;
    }

    @Override
    public String setUriType(String uriType) {
        return  this.uriType=TextUtils.isEmpty(uriType)?"":uriType;
    }

    @Override
    public String setReqType(String reqType) {
        return this.reqType=TextUtils.isEmpty(reqType)?"":reqType;
    }
    private String ip;
    @Override
    public String getReqType() {
        return this.reqType;
    }

    @Override
    public void setIp(String ip) {
        this.ip=ip;
    }

    @Override
    public String getIp() {
        return TextUtils.isEmpty(ip)? UrlsTools.REQ_URL:ip;
    }


    public void setType(Type type) {
        this.type = type;
    }

    private Type type;
    public LRequest(){
        data=new HashMap<>();
    }
    @Override
    public void addParam(String key, Object value) {
        data.put(key,value);
    }

    @Override
    public Map<String, Object> getParam() {
        return data;
    }

    @Override
    public boolean isNeedProgress() {
        return isShowProgress;
    }

    @Override
    public void setUri(String url) {
        Log.d("LRequest","url=="+url);
        this.uri= TextUtils.isEmpty(url)?"":url;
    }

    @Override
    public void setNeedProgress(boolean isShow) {
        isShowProgress=isShow;
    }


}
